package com.linkoog.devtools.intellij;

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.application.ApplicationInfo;
import com.intellij.openapi.application.ex.ApplicationInfoEx;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.awt.event.InputEvent;

public class AnActionEventFactory {



    public static AnActionEvent createFromAnAction(@NotNull AnAction action, @Nullable InputEvent event, @NotNull String place, @NotNull DataContext dataContext){
       /*
        applicationInfo.getMajorVersion();
        JBRadioAction .this.actionPerformed(AnActionEvent.createFromAnAction(JBRadioAction.this, null, "unknown",dataContext));
        //JBRadioAction.this.actionPerformed();
*/
        ApplicationInfo applicationInfo = ApplicationInfoEx.getInstance();
        int majorVersion = toInt(applicationInfo.getMajorVersion(), 0);
        int minorVersion = toInt(applicationInfo.getMinorVersion(), 0);
        if ((majorVersion >= 2024 && minorVersion >= 3) ) {
            //AnActionEvent.createEvent(action, dataContext, null, "unknown", ActionUiKind.NONE, null)
        }


        return null;
    }

    private static int toInt(String s, int defaultValue){
        try {
            return Integer.parseInt(s);
        } catch (NumberFormatException e) {
            return defaultValue;
        }
    }

}
